package com.glory.erp.auth.role.dao.impl;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.glory.erp.auth.role.dao.RoleDao;
import com.glory.erp.auth.role.bean.Role;
import com.glory.erp.auth.role.bean.RoleQuery;
import com.glory.erp.auth.base.BaseDaoImpl;
import com.glory.erp.auth.base.BaseQueryModel;

public class RoleDaoImpl extends BaseDaoImpl<Role> implements RoleDao{

	public void doQbc(DetachedCriteria dc,BaseQueryModel qm){
		RoleQuery roleQuery = (RoleQuery)qm;
		if (roleQuery.getName() != null
				&& roleQuery.getName().trim().length() > 0) {
			dc.add(Restrictions.like("name", "%" + roleQuery.getName().trim()
					+ "%"));
		}
		if (roleQuery.getCode() != null
				&& roleQuery.getCode().trim().length() > 0) {
			dc.add(Restrictions.like("code", "%" + roleQuery.getCode().trim()
					+ "%"));
		}
	}
}